import importlib
from models.models import ModelType

def calculate_model_parameters():
    for model_type in ModelType:
        try:
            module_name = f"models.{model_type.value}"
            module = importlib.import_module(module_name)

            class_name = model_type.value[0].upper() + model_type.value[1:]
            ModelClass = getattr(module, class_name)

            model_instance = ModelClass()

            trainable_params = sum(p.numel() for p in model_instance.parameters() if p.requires_grad)
            print(f'{class_name} \t的参数数量: {trainable_params}')

        except Exception as e:
            print(f"Error loading {model_type.value}: {e}")
